/*
 *  (C) Copyright 2008 Insula Tecnologia da Informacao Ltda.
 * 
 *  This file is part of Vulcano.
 *
 *  Vulcano is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Vulcano is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Vulcano.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.openinsula.vulcano.orm.command.transaction.operations;

import java.util.Collection;
import java.util.List;

import org.openinsula.vulcano.orm.command.transaction.InitializeCallback;
import org.openinsula.vulcano.orm.dao.query.DaoQuery;

public interface DaoCommandTransactionOperations {

	<T> T findById(final Class<T> entityClass, final Object id);
	
	<T> T findById(final InitializeCallback<T> initializeCallback, final Class<T> entityClass, final Object id);

	<T> List<T> listAll(final Class<T> entityClass);
	
	<T> List<T> listAll(final InitializeCallback<List<T>> initializeCallback, final Class<T> entityClass);

	<T> List<T> find(final InitializeCallback<List<T>> initializeCallback, final String queryString, final Object... values);
	
	<T> List<T> find(final String queryString, final Object... values);
	
	<T> List<T> find(final InitializeCallback<List<T>> initializeCallback, final DaoQuery daoQuery);
	
	<T> List<T> find(final DaoQuery daoQuery);
	
	<T> T findUnique(final InitializeCallback<T> initializeCallback, final DaoQuery daoQuery);
	
	<T> T findUnique(final DaoQuery daoQuery);
	
	<T> T findUnique(final InitializeCallback<T> initializeCallback, final String queryString, final Object... values);
	
	<T> T findUnique(final String queryString, final Object... values);

	<T> int save(final T... entities);

	int saveAll(final Collection<?> entities);

	<T> int delete(final T... entities);

	int deleteAll(final Collection<?> entities);

	int deleteAll(final Class<?> entityClass);

	int update(final String queryString, final Object... values);

	<T> void refresh(final InitializeCallback<T> initializeCallback, final T entity);
	
	void refresh(final Object entity);

	<T> void reattach(final InitializeCallback<T> initializeCallback, final T entity);
	
	void reattach(final Object entity);

	<T> T merge(final T entity);
	
}